This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Compute yearly inflation on-chain allowing to change x_ideal according to number of slots.#8332
Merged
Compute yearly inflation on-chain allowing to change x_ideal according to number of slots.#8332
Conversation
4508a34 to
a738f2a
Compare
a738f2a to
6b7107a
Compare
6b7107a to
a32903b
Compare
gui1117
commented
Mar 17, 2021
|
|
||
| let error = (res - expect).abs(); | ||
|
|
||
| if error > 8f64 / accuracy_f64 && error > 8.0 * f64::EPSILON { |
Contributor
Author
There was a problem hiding this comment.
this accuracy with EPSILON is at least needed because f64 doesn't have enough precision compare to perquintillion.
gui1117
commented
Mar 17, 2021
| /// Compute a div b. | ||
| /// | ||
| /// requires `b` to be stripped and have no leading zeros. | ||
| fn div_by_stripped(mut a: BigUint, b: &BigUint) -> BigUint { |
Contributor
Author
There was a problem hiding this comment.
cc @kianenigma I'm finally using this implementation to be able to divide by any stripped biguint.
gavofyork
reviewed
Mar 17, 2021
Co-authored-by: Gavin Wood <[email protected]>
gavofyork
approved these changes
Mar 19, 2021
hirschenberger
pushed a commit
to hirschenberger/substrate
that referenced
this pull request
Apr 14, 2021
…g to number of slots. (paritytech#8332) * new crate * Update frame/staking/reward-fn/src/lib.rs Co-authored-by: Gavin Wood <[email protected]> * fix doc Co-authored-by: Gavin Wood <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #6469
Intruduce a new crate which expose:
compute_inflationallowing to compute yearly inflation directly usingcurrent_stake_rate,ideal_stake_rateandfalloff.NOTE: we don't support falloff lower than 0.01, if we want to support it I think we can. If falloff is less than 0.01 the curve fall down very very fast, and we should probably return inflation = 0 and not compute taylor serie when stake is a bit far form ideal_stake.